<template>
  <div class="app-container">
    <div class="  flex-column" style="width: 100%;height: 100%;">
      <div class="flex-between mt10 mb10">
        <div>

        </div>
        <div class="mr10">

          <el-button type="primary" @click="CloseCurrentTab()">关闭</el-button>
        </div>
      </div>
      <div style="flex: 1;position:relative;">
         <div v-html="content">

         </div>
      </div>
      <div style="height: 20px;"></div>
    </div>
  </div>

</template>

<script>
  import {
    Get_Content
  } from "@/api/system/notice";

  export default {
    name: "ViewNoice",
    components: {},
    data() {
      return {
        id: '',
        type: '',
        title: '',
        content: '',
        filename: ''
      }
    },
    created() {

      const id = this.$route.params && this.$route.params.id;
      this.type = this.$route.params && this.$route.params.type;
      console.log("A");
      console.log(id);
      console.log(this.type);
      this.get_content(id);
    },
    methods: {
      /** 获取文档 */
      get_content(id) {
        var params = {
          type:this.type,
          id: id
        }

        Get_Content(params).then(res => {

          this.id = res.id;
          this.title = res.title;
          this.filename = res.filename;
          this.content = res.content;
          this.$nextTick(() => {
            // this.$refs.editor.setEditorHtml(this.content)
          });
          let visitedViews = this.$store.state.tagsView.visitedViews;
          visitedViews.some(v => {
            if (v.path == this.$route.path) {
              v.title = res.title;
            }
          })
        });

      },




    }
  };
</script>
